/**   
 * @文件名称: SysPersonnel.java
 * @类路径: cn.ccew.sys.model
 * @描述: TODO
 * @公司：春城1网
 * @作者：李兴建
 * @时间：2013-10-1 上午11:27:51
 * @版本：V1.0   
 */

package cn.ccew.sys.model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import cn.ccew.common.base.model.BaseEntity;

/**
 * @类功能说明：
 * @类修改者：
 * @修改日期：
 * @修改说明：
 * @公司：春城1网
 * @作者：李兴建
 * @创建时间：2013-10-1 上午11:27:51
 * @版本：V1.0
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "sys_personnel")
public class SysPersonnel extends BaseEntity {

	/**
	 * 登录账号
	 */
	private String loginName;
	/**
	 * 登录密码
	 */
	private String loginPassword;
	/**
	 * 真实姓名
	 */
	private String realName;
	/**
	 * 性别
	 */
	private String sex;
	/**
	 * 移动电话
	 */
	private String phone;
	/**
	 * 电话
	 */
	private String tel;
	/**
	 * qq
	 */
	private String qq;
	/**
	 * 邮箱
	 */
	private String email;

	/**
	 * 状态
	 */
	private int infoState;
	@Transient
	private String infoStateString;

	/**
	 * 关联机构
	 */
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "org_id")
	private SysOrgnization org;

	/**
	 * 所属资源
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "resources_id")
	private SysResources resources;

	/**
	 * 所属角色
	 */
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id")
	private SysRole role;

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public SysResources getResources() {
		return resources;
	}

	public void setResources(SysResources resources) {
		this.resources = resources;
	}

	public SysRole getRole() {
		return role;
	}

	public void setRole(SysRole role) {
		this.role = role;
	}

	public String getLoginPassword() {
		return loginPassword;
	}

	public void setLoginPassword(String loginPassword) {
		this.loginPassword = loginPassword;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public SysOrgnization getOrg() {
		return org;
	}

	public void setOrg(SysOrgnization org) {
		this.org = org;
	}

	public int getInfoState() {
		return infoState;
	}

	public void setInfoState(int infoState) {
		this.infoState = infoState;
	}

	public String getInfoStateString() {
		// 0未启用 1：启用 2：锁定
		switch (infoState) {
		case 0:
			infoStateString = "未启用";
			break;
		case 1:
			infoStateString = "启用";
			break;
		case 2:
			infoStateString = "锁定";
			break;

		default:
			break;
		}
		return infoStateString;
	}

	public void setInfoStateString(String infoStateString) {
		this.infoStateString = infoStateString;
	}

}
